-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add default_admin_services node #7077
Add default_admin_services node #7077
Conversation
One question: Why dont you decorate the service you want to modify? It is a feature available at the symfony dependency injection component and it allows to not write more code to do the same |
I don't always want to modify a service. |
c209e99
to
d94691a
Compare
Please review @sonata-project/contributors |
I will update the tests after #7127 |
0c72528
to
2e1bc4d
Compare
Please review @sonata-project/contributors |
If the use case was to select one of the available label translation strategies, what about to just add an option to set the default one? |
What's the issue with the option Other use case can be:
|
IMO for modifying existing services you can do it with a service decorator as @jordisala1991 said, I think we don't need to provide a way to override them (it is the way it's documented in Symfony for overriding services from a bundle). For templates we already have a |
I may not understanding correctly decoration, but I don't think it solves the issue. In #4637, the goal is to use a different label_translator_strategy. For pager_type, you can use Another example: I wrote a whole custom datasource service and I'd like to use it for almost all my admin.
We can add |
What I meant is:
For example in doctrine:
dbal:
default_connection: default
orm:
default_entity_manager: ~ We could add: sonata_admin:
default_label_strategy: 'sonata.admin.label.strategy.native' # by default This way, instead of: SonataAdminBundle/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php Line 323 in a8f16a1
could be
and If for example we create a service that receives the label translation strategy, this way we could inject
In this case (I know it was that way, but this is a new feature)
When decorating the service there is no need to configure it with the existing one, you can use it or not.
IMHO if we already have a configuration for templates (and if it's possible), we should use it, AFAIK the |
When I read the documentation
The old definition is lost.
You might want to use your custom service 90% of the time and still keep the old definition sometimes.
I just followed the existing feature, and the way it's done for attributes of the tag
SonataAdminBundle/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php Line 256 in a8f16a1
SonataAdminBundle/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php Line 351 in a8f16a1
IMHO we should keep consistency between the What I have in mind is to allow the user to change the default values of the |
f25d0d9
to
b735fa7
Compare
@franmomu @jordisala1991 Can you take a new look ?
|
d885f96
to
4f70788
Compare
Can I get some review @sonata-project/contributors |
->arrayNode('form_theme') | ||
->prototype('scalar')->end() | ||
->end() | ||
->arrayNode('filter_theme') | ||
->prototype('scalar')->end() | ||
->end() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these new values be documented somewhere?
I updated the doc :) |
Perhaps it would be worthwhile to somehow more explicitly state that this change breaks BC, and give an upgrade example. -sonata_doctrine_orm_admin:
- templates:
- form:
- - '@Frontend/Admin/form/doctrine_orm_admin_fields.html.twig'
- - '@Frontend/Admin/form/admin_fields.html.twig'
- filter:
- - '@Frontend/Admin/form/filter_fields.html.twig'
+sonata_admin:
+ templates:
+ form_theme:
+ - '@Frontend/Admin/form/doctrine_orm_admin_fields.html.twig'
+ - '@Frontend/Admin/form/admin_fields.html.twig'
+ filter_theme:
+ - '@Frontend/Admin/form/filter_fields.html.twig' |
This PR is not supposed to break BC. |
Subject
BC
Changelog